home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Answers 2002 January
/
PC Answers January 2002.7z
/
PC Answers January 2002.bin
/
graphics
/
freepixl
/
_SETUP.1
/
Comms2.pxl
< prev
next >
Wrap
Text File
|
1998-02-18
|
5KB
|
189 lines
Initialize:
Title1$ = "Message Passing App #1"
Title2$ = "Message Passing App #2"
UseCaption(Title2$)
UseCoordinates(PIXEL)
UseBackGround(TRANSPARENT,192,192,192)
DrawBackGround
WinLocate(Title2$,250,10,680,240,Res)
{ WinShow(Title2$,NOTOPMOST,Res) }
DirGet(SourceDir$)
WinGetClientRect("",cx1,cy1,cx2,cy2)
InfoMenu(REMOVE)
WaitInput(100) {let NT and 95 catch up}
SetMenu("E&xit!",Leave,
ENDPOPUP,
"&Mode",IGNORE,
"Set &Transmit Mode",Transmit,
"Set &Receive Mode",Receive,
"&Loop",CommLoop,
SEPARATOR,
"Jump to Label",JumpLabel,
"Copy Data",CopyDataJump,
"Clear",Clear,
"Clear Both",ClearBoth,
ENDPOPUP,
"&Help",IGNORE,
"&Concept",Concept,
"&View Source",ViewSource,
"&About",About,
ENDPOPUP)
StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0)
DrawStatusWinText(0,"Ready")
Loop = 0
Wait_for_Input:
WaitInput()
{ NOTE: if a PXLResume message is received while the
program is pausing at the above WaitInput(), it will
proceed directly to the next command, and then in this
case, exit.
You may want to program a simple solution around this,
such as ...
Goto Wait_for_Input
or instead use the PXLResumeAt(...) command. }
Leave:
WinClose(Title1$,Res)
End
Clear:
SetRightMouse()
SetMouse()
Loop = 0
DrawBackground
DrawStatusWinText(0,"Ready")
DrawStatusWinText(1,"")
Goto Wait_for_Input
ClearBoth:
SetRightMouse()
SetMouse()
Loop = 0
DrawBackground
DrawStatusWinText(0,"Ready")
DrawStatusWinText(1,"")
PXLresumeAt(Title1$,"Clear",Title2$,Res)
Goto Wait_for_Input
CopyDataJump:
Msg$ = "ReceiveCopyData Arbitary message from #2"
SendCopyDataMsg(Title1$,Msg$)
Goto Wait_for_Input
ReceiveCopyData:
GetCopyDataMsg(MSg$)
DrawText(10,70,Msg$)
Goto Wait_for_Input
JumpLabel:
PXLresumeAt(Title1$,"JumpLabel_1",Title2$,Res)
WaitInput(1)
{NOTE: in THIS SPECIFIC case, the WaitInput(1) is needed because the
application will overwrite the jump_label string. ie you must give the
target application time to process the command. You could also put
in a WaitInput() here and have the target application send a PXLresume}
PXLresumeAt(Title1$,"JumpLabel_1a",Title2$,Res)
WaitInput(1)
PXLresumeAt(Title1$,"JumpLabel_1b",Title2$,Res)
If Res = 0 Then MessageBox(OK,1,INFORMATION,"Resume in #1 failed","DEBUG",Res)
Goto Wait_for_Input
JumpLabel_2:
DrawBackground
DrawText(10,10,"Processed resume at JumpLabel_2 Message")
Goto Wait_for_Input
JumpLabel_2a:
DrawText(10,30,"Processed resume at JumpLabel_2a Message")
Goto Wait_for_Input
JumpLabel_2b:
DrawText(10,50,"Processed resume at JumpLabel_2b Message")
Goto Wait_for_Input
CommLoop:
Loop = 1
DrawStatusWinText(1,"Loop Enabled")
Goto Wait_for_Input
Transmit:
SetRightMouse(cx1,cy1,cx2,cy2,StopProcess,X,Y)
SetMouse(cx1,cy1,cx2,cy2,Process,X,Y)
DrawStatusWinText(0,"Transmit Enabled")
If Loop = 0 Then Goto Wait_for_Input
Receive:
WaitInput() {This is the WaitInput that the loop mode cycles around}
DrawBackGround
DrawIcon(10,10,64,64,ICON02)
WaitInput(1)
If Loop = 0 Then Goto Wait_for_Input
Process:
SetMouse()
PXLResume(Title1$,Res)
WaitInput(1)
If Res = 0 Then MessageBox(OK,1,INFORMATION,"Msg Failed",Title2$ ,Res)
If Loop = 1 Then Goto Receive
Goto Wait_for_Input
StopProcess:
Loop = 0
SetRightMouse()
DrawStatusWinText(0,"Ready")
Goto Receive {or the last 'resume' from #1 will hit Wait_for_Input then exit.}
Concept:
Loop = 0
SetMouse()
SetRightMouse()
DrawStatusWinText(0,"Ready")
MessageBox(OK,1,INFORMATION,
"This sample program demonstrates how two PiXCL
applications can communicate with each other by
passing a 'resume' message after a WaitInput()
command has been issued.
You can select transmit or receive ONE message at a time,
or select LOOP, then receive or transmit, and the two
programs will alternate sending 'resume' messages to
each other.
Once you have set up the transmit and receive modes,
click in the transmit window client area to start.
You can also send arbitary length messages to the
other window.
Clicking 'Exit' will close both message apps.",
"Message Passing",Res)
Goto Wait_for_Input
ViewSource:
PXLFile$ = SourceDir$ + "\comms2.pxl"
CmdLine$ = "NotePad " + PXLFile$
Run(CmdLine$)
Goto Wait_for_Input
About:
AboutUser("Message Passing with PiXCL 4.1",
"WaitInput(), PXLResume and PXLResumeAt commands.",
"A PXL application can wait for another application to tell it to continue at the current point or any label.")
Goto Wait_for_Input